package com.rui.strategy.model;

import com.rui.strategy.obj.card.CopperCard;
import com.rui.strategy.obj.card.GoldCard;
import com.rui.strategy.obj.card.SilverCard;
import com.rui.strategy.obj.card.VipCard;
import com.rui.strategy.obj.card.Normal;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Description: 会员卡容器类
 * @Author: ZhangRui
 * @Date: 2023/3/3 13:40
 * @Version: 1.0
 */
public class VipCardFactory {

    private static Map<String, VipCard> map = new ConcurrentHashMap<>();

    static {
        map.put("gold", new GoldCard());
        map.put("silver", new SilverCard());
        map.put("copper", new CopperCard());
    }

    public static VipCard getVIPCard(String level) {
        return map.get(level) != null ? map.get(level) : new Normal();
    }

}
